package com.wing.order.model.entity;

import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 以旧换新(存旧刀，领新刀)
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("cab_old_new_order")
public class OldNewOrder extends BaseEntity<OldNewOrder> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum Status implements IEnum<Integer> {

        /**
        * 0:已完成
        */
        created(0,"0:已完成");

        private int code;
        private String desc;

        Status(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum IsBill implements IEnum<Integer> {

        /**
        * 未形成
        */
        no(0,"未形成"),
        /**
        * 已形成
        */
        yes(1,"已形成");

        private int code;
        private String desc;

        IsBill(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 存刀任务编号
     */
    private String code;

    /**
     * 订单id
     */
    private Long deliveryId;

    /**
     * 状态
     */
    private Status status;

    /**
    * 状态描述
    */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status == null ? null : status.getDesc();
    }

    /**
     * no
     */
    private Integer no;

    /**
     * day
     */
    private Integer day;

    /**
     * 设备台机
     */
    private String deviceCode;

    /**
     * 是否已同步：no(0,未同步);yes(1,已同步);
     */
    private Integer isSyns;

    /**
    * 同步时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime synsTime;

    /**
     * 是否已形成账单
     */
    private IsBill isBill;

    /**
    * 是否已形成账单描述
    */
    @TableField(exist = false)
    private String isBillDesc;

    public String getIsBillDesc() {
        return isBill == null ? null : isBill.getDesc();
    }

    /**
     * companyId
     */
    private Long companyId;

    /**
     * 之前领新单id(关联cab_cell_inventory_inout表的id)
     */
    private Long oldCellInventoryInoutId;

    /**
     * 暂存柜存入id(关联cab_storage_inventory_inout表的id)
     */
    private Long storageInventoryInoutId;

    /**
     * 新领新单id(关联cab_cell_inventory_inout表的id)
     */
    private Long newCellInventoryInoutId;

    /**
     * skuCode
     */
    private String skuCode;

    private Long workOrderId;

    /**
     * 企业编码
     */
    private String enterpriseCode;


    private String departmentName;

    private String roleName;

    private Long departmentId;
}
